package com.example.sunsg.okhttptest.activity;

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.animation.LinearInterpolator;

import com.breadtrip.R;
import com.example.sunsg.okhttptest.cuseomannotation.ViewAnnotation;
import com.example.sunsg.okhttptest.customview.BitmapShaderTestView;
import com.example.sunsg.okhttptest.util.AnnotationUtil;


public class BitmapShaderActivity extends AppCompatActivity {
    public static void launch(Activity activity){
        Intent intent = new Intent(activity,BitmapShaderActivity.class);
        activity.startActivity(intent);
    }
    @ViewAnnotation(R.id.bitmap_shader_view)
    private BitmapShaderTestView mBitmapShaderTestView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bitmap_shadow);
        AnnotationUtil.injectionView(this);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
//        mBitmapShaderTestView.animate().rotation(45);
        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBitmapShaderTestView,"rotation",0f,360f*10);
        objectAnimator.setDuration(1000*10);
        objectAnimator.setRepeatCount(-1);
        objectAnimator.setInterpolator(new LinearInterpolator());
//        objectAnimator.start();
    }

}
